<?php
$name = $_POST['name'];
$pwd = $_POST['pwd'];
//连接数据库
$conn = mysqli_connect('localhost', 'root', 'root', '2005');
//设置编码，防止乱码
mysqli_query($conn, "set charset 'utf8'");
mysqli_query($conn, "set character set 'utf8'");

$sql = "insert into user (name,pwd) values ('$name','$pwd')";
$res = mysqli_query($conn, $sql);//资源型数据
if($res) {
	echo json_encode(array(
	"code" => 200,
	"body" =>array(
	"msg" => "注册成功"
	)));
}else {
	echo json_encode(array(
	"code" => 204,
	"body" =>array(
	"msg" => "网络错误"
	)
	));
}
?>